package com.tyk.bookstore.back.member.util;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tyk.bookstore.back.member.model.dto.DeliveryAddress4OrderDto;
import com.tyk.bookstore.back.member.model.entity.DeliveryAddressDo;
import com.tyk.bookstore.back.member.model.entity.MemberDetailDo;
import com.tyk.bookstore.back.member.model.entity.MemberDo;
import com.tyk.bookstore.back.member.model.query.DeliveryAddressAddQuery;
import com.tyk.bookstore.back.member.model.query.DeliveryAddressUpdateQuery;
import com.tyk.bookstore.back.member.model.query.MemberAddQuery;
import com.tyk.bookstore.back.member.model.query.MemberUpdateQuery;
import com.tyk.bookstore.back.member.model.vo.DeliveryAddressPageVo;
import com.tyk.bookstore.back.member.model.vo.DeliveryAddressVo;
import com.tyk.bookstore.back.member.model.vo.MemberPageVo;
import com.tyk.bookstore.back.member.model.vo.MemberVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface MapStructMember {
    MemberVo toMemberVo(MemberDo member, MemberDetailDo memberDetail);

    @Mapping(target = "records", ignore = true)
    MemberPageVo toMemberPageVo(Page<MemberDo> page);

    MemberPageVo.Member toMemberPageVo$Member(MemberDo memberDo, MemberDetailDo memberDetailDo);

    MemberDo toMemberDo(MemberAddQuery query);

    MemberDo toMemberDo(MemberUpdateQuery query);

    @Mappings({@Mapping(target = "area", ignore = true)})
    DeliveryAddressVo toDeliveryAddressVo(DeliveryAddressDo deliveryAddress);

    DeliveryAddressPageVo toDeliveryAddressPageVo(Page<DeliveryAddressDo> page);

    @Mappings({
            @Mapping(target = "id",ignore = true)
    })
    DeliveryAddressDo toDeliveryAddressDo(DeliveryAddressAddQuery query);

    DeliveryAddressDo toDeliveryAddressDo(DeliveryAddressUpdateQuery query);

   DeliveryAddress4OrderDto toDeliveryAddress4OrderDto(DeliveryAddressDo deliveryAddress);
}
